import { request } from "@/utils/http";
import { Key } from "react";
import { getHosSetListItemType,updateHosSetParamsType,getHosSetListReturnType, getHosSetListParamsType,addHospitalParamType } from "./model/hospitalSetTypes";

export const getHosSetListRequest = ({ page, limit, hosname, hoscode }: getHosSetListParamsType) => {
    return request.get<any, getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params: {
            hosname,
            hoscode
        }
    })
}

export const addHosSetFormRequest=(data:addHospitalParamType)=>{
    return request.post<any,null>('/admin/hosp/hospitalSet/save',data)
}

export const getHosSetFormRequest=(id:string|undefined)=>{
    return request.get<any,getHosSetListItemType>(`/admin/hosp/hospitalSet/get/${id}`)
}

export const updateHosSetFormRequest=(data:updateHosSetParamsType)=>{
    return request.put<any,null>('/admin/hosp/hospitalSet/update',data)
}

export const deleteHosSetRequest=(id:string)=>{
    return request.delete<any,null>(`/admin/hosp/hospitalSet/remove/${id}`)
}

export const batchRemoveHosSetRequest=(ids:Key[])=>{
    return request.delete('/admin/hosp/hospitalSet/batchRemove',{
        data:ids
    })
}